Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2ExcelManager = require("ExcelManager");
var $2UserDataManager = require("UserDataManager");
var def_DataManager = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    this.row = 5;
    this.col = 9;
    this.groudStartPo = cc.v2(-360, -320);
    this.blockArr = new Array();
    this.blockWidth = 80.5;
    this.blockHeight = 93;
    this.groudYArr = new Array();
    this.selectPlantID = [];
    this.rare1Array = [];
    this.rare2Array = [];
    this.rare3Array = [];
    this.rare4Array = [];
    this.rare5Array = [];
    this.rareArray = [1, 3, 4, 5];
    this.plantArray = [];
    this.newPlant = [];
    this.tryPlant = [];
    this.lockPlant = 0;
    this.noCD = false;
    this.multi_plants = false;
    this.focus = false;
    this.level = 1;
    this.newChapter = false;
    this.drawWeight1 = [];
    this.drawWeight2 = [];
    this.drawGuide = false;
    this.bossGuide = false;
    this.signNote = false;
    this.maxWeight1 = 0;
    this.maxWeight2 = 0;
    this.bossLevel = 0;
    this.bowlingLevel = 0;
    this.extraGold = 0;
    this.maxPlantID = 0;
    this.beforeLevel = 1;
    this.rarePrice1 = [0, 0];
    this.rarePrice2 = [0, 0];
    this.rarePrice3 = [0, 0];
    this.rarePrice4 = [0, 0];
    this.rarePrice5 = [0, 0];
    this.spineLoad = false;
    this.rareColor = [cc.color(255, 255, 255, 255), cc.color(163, 233, 15, 255), cc.color(62, 205, 249, 255), cc.color(202, 110, 243, 255), cc.color(255, 199, 3, 255)];
    this.game_time = 0;
    this.cur_hp = 3;
    this.total_hp = 3;
    this.is_over = true;
    this.yx_start_time = 0;
    this.offset_time = 0;
    this.fuhuo_flag = false;
    this.is_running = false;
    this.distance = 0;
    this.fd_num = 0;
    this.is_bowling = false;
  }
  babel_createClass(_ctor, [{
    key: "init",
    value: function init() {
      this.initBlockPos();
      this.initPlantArr();
      this.initDrawWeight();
      this.initPrice();
      this.level = $2UserDataManager.default.instance.level;
    }
  }, {
    key: "initPrice",
    value: function initPrice() {
      this.rarePrice1[0] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[1].coinCost;
      this.rarePrice1[1] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[1].diamondCost;
      this.rarePrice3[0] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[2].coinCost;
      this.rarePrice3[1] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[2].diamondCost;
      this.rarePrice4[0] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[3].coinCost;
      this.rarePrice4[1] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[3].diamondCost;
      this.rarePrice5[0] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[4].coinCost;
      this.rarePrice5[1] = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.priceTable)[4].diamondCost;
    }
  }, {
    key: "initDrawWeight",
    value: function initDrawWeight() {
      var e = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.lotteryTable);
      var t = Object.keys(e);
      for (var _a12 = 0; _a12 < t.length; _a12++) {
        var _n22 = e[t[_a12]].weight1;
        var _i7 = e[t[_a12]].weight2;
        this.maxWeight1 += _n22;
        this.maxWeight2 += _i7;
        this.drawWeight1.push(this.maxWeight1);
        this.drawWeight2.push(this.maxWeight2);
      }
    }
  }, {
    key: "initPlantArr",
    value: function initPlantArr() {
      for (var _e17 = 0; _e17 < $2ExcelManager.ExcelMgr.instance.GetExcelArray($2ExcelManager.TableName.plantTable).length; _e17++) {
        this.plantArray.push($2ExcelManager.ExcelMgr.instance.GetExcelArray($2ExcelManager.TableName.plantTable)[_e17].id);
      }
      for (var _e18 = 0; _e18 < this.plantArray.length; _e18++) {
        switch ($2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.plantTable)[this.plantArray[_e18]].rare) {
          case 1:
            this.rare1Array.push(this.plantArray[_e18]);
            break;
          case 2:
            this.rare2Array.push(this.plantArray[_e18]);
            break;
          case 3:
            this.rare3Array.push(this.plantArray[_e18]);
            break;
          case 4:
            this.rare4Array.push(this.plantArray[_e18]);
            break;
          case 5:
            this.rare5Array.push(this.plantArray[_e18]);
        }
      }
    }
  }, {
    key: "initBlockPos",
    value: function initBlockPos() {
      for (var _e19 = 0; _e19 < this.row; _e19++) {
        for (var _t15 = 0; _t15 < this.col; _t15++) {
          this.blockArr[_e19] || (this.blockArr[_e19] = new Array());
          this.blockArr[_e19][_t15] = [cc.v2(this.groudStartPo.x + this.blockWidth * (_t15 + .5), this.groudStartPo.y + this.blockHeight * (_e19 + .5)), null];
        }
      }
      for (var _e20 = 0; _e20 < this.blockArr.length; _e20++) {
        this.groudYArr.push(this.blockArr[_e20][0][0].y + 40);
      }
    }
  }, {
    key: "clearTempData",
    value: function clearTempData() {
      if (0 != _ctor.instance.maxPlantID) {
        $2UserDataManager.default.instance.setPlantLevel(_ctor.instance.maxPlantID, _ctor.instance.beforeLevel, true);
        _ctor.instance.beforeLevel = 1;
        _ctor.instance.maxPlantID = 0;
      }
      _ctor.instance.tryPlant = [];
    }
  }], [{
    key: "instance",
    get() {
      this._instance || (this._instance = new _ctor());
      return this._instance;
    }
  }]);
  return _ctor;
}();
exports.default = def_DataManager;
def_DataManager._instance = null;